In this assignment I was required to design and develop a 2D interactive graphical application that demonstrates a wide range of computer graphics features and processes. The game uses SFML as the graphics API.
Player has to destroy all Zombies spawned in the game. There are several weapons to use by the player: knife, pistol, assault rifle and flashlight.
The player controls a player character using a combination of keyboard and mouse controls. The WASD keys are used to makethe character move forward, strafe left, move back, and strafe right respectively. When the right-mouse button is pressed, the character rotates to face the mouse pointer and when the left-mouse button is pressed, the character performs actions depending on the currently equipped weapon. The player can change the currently equipped weapon by pressing shortcutkeys.
I have implemented a simple AI for enemies. They will move towards the location of the player character and into attacking state if they sense its presence. However if player is not present within their sight range they will move to random position.The sensing is emulated as one check (to emulate seeing). It checks the distance against visual distance (RV) and a 90° view field. If the check is satisfied then the NPC will go into attacking state.
The player is be able to see areas immediately surrounding the character and in front of it as lit up by a torch. This effect has been achieved using additional SFML RenderTexture and byappropriate applying texture transparency and blending effects. It is very useful during the night as it allows player to see enemies and obsacles withng in the game level.
The game world is viewed using a virtual camera positioned directly above the player character looking straight down. Whenever the character moves the camera is moving accordingly following the character. There are also two additional partially transparent layers of texture rendered after the character. The first one scrolls independently to the character movement while the other is fixed. These layers are visually emulating objects at higher position and are implemented as parallax scrolling.I also implemented the camera zooming via keyboard key presses.
The game starts by displaying a title screen. The game's main menu includes: Start a Game, Display Credits, Quit the Game. When the game starts for the first time, on - screen texts are displayed to show the background story of the game before continuing to the gameplaying state. The application will proceed to the gameplaying state if the user presses the Escape key or when the text typing animation is completed. While in the gameplaying state, if the user presses the Escape key, the game will pause and show the same game menu.
While in the gameplaying state, the game world is viewed from top-down directly perpendicular to the game world planes. In addition to showing the view of the game world, the application also displays relevant information about the player character in an overlaid Head Up Display. The HUD shows: Character Portrait, Character Health Bar, Image of the currently equipped weapon.